#include ../Makefile.param
#
#
#CXX = aarch64-v01c01-linux-musl-g++
#CXXFLAGS += -Wall -std=c++11 -g -O2 
##LDFLAGS := -L/usr/local/lib 
##LDLIBS := -lpthread  -lcamera
# 
#
#SRC_PATH := $(shell pwd)
## INC_FLAGS += -I$(SRC_PATH)/include
## CFLAGS += -Wall -g $(INC_FLAGS)
#
#SRCS += $(SRC_PATH)/main.cpp
#
#
#LIBCAMERA_DIR ?= -L/usr/local/
#COMM_INC += -I$(LIBCAMERA_DIR)/include/libcamera/
#MPI_LIBS += -L/usr/local/lib
#MPI_LIBS += -lcamera -lcamera-base
#
#TARGET := libcamera
#
#OBJS = $(patsubst %.cpp,%.o,$(SRCS))
#DEPS := $(OBJS:.o=.d) 
#all: $(TARGET)
##TARGET_PATH := $(PWD)
#$(TARGET): $(OBJS)
#    $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
#
#%.o: %.cpp
#    $(CXX) $(CXXFLAGS) -c $< -o $@
#
## compile linux or LITEOS
##include $(PWD)/../$(ARM_ARCH)_$(OSTYPE).mak
#
#
#clean:
#    rm -f $(OBJS) $(TARGET)
    

    # 编译器设置
CXX = aarch64-v01c01-linux-musl-g++
CXXFLAGS += -std=c++17 -Wall -Wextra -O2 -I/home/hisi2025_3/libcamera/include/libcamera 
#CXXFLAGS := -std=c++17 -Wall -Wextra -O2
LDFLAGS := -L/home/hisi2025_3/libcamera/lib
LDLIBS := -lcamera -lcamera-base -lpisp -lyaml -levent -levent_pthreads

SRC_DIR := src/cam
BUILD_DIR := build
TARGET := camera_cap

SRCS := $(wildcard $(SRC_DIR)/*.cpp)
OBJS := $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SRCS))

all: $(BUILD_DIR)/$(TARGET)

$(BUILD_DIR)/$(TARGET): $(OBJS)
	$(CXX) $(LDFLAGS) $^ -o $@ $(LDLIBS)

$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp | $(BUILD_DIR)
	$(CXX) $(CXXFLAGS) -c $< -o $@

$(BUILD_DIR):
	mkdir -p $@

clean:
	rm -rf $(BUILD_DIR)

.PHONY: all clean
